home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / mayaFileOptions.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.9 KB  |  93 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. global proc int mayaFileOptions ( string $parent, string $action,
  18.                                     string $initialSettings, string $resultCallback )
  19. //
  20. //    Description:
  21. //        This script posts the maya file accessor options.
  22. //
  23. //    Parameters:
  24. //        $parent    - the elf parent layout for this options layout. It is
  25. //                    always a scrollLayout.
  26. //        $action    - the action that is to be performed with this invokation
  27. //                    of this proc. Valid options are:
  28. //                        "query" - construct the options string and pass it
  29. //                                    to the resultCallback.
  30. //                        "post"    - post all the elf controls.
  31. //        $resultCallback    -
  32. //                This is the proc to be called with the result string. 
  33. //                resultCallback ( string $optionsString )
  34. //
  35. //    Returns:
  36. //        1 if successfull.
  37. //        0 otherwise.
  38. //
  39. {
  40.     int $bResult;
  41.     string $currentOptions;
  42.     string $optionList[];
  43.     string $optionBreakDown[];
  44.     int        $index;
  45.     
  46.     if ($action == "post") {
  47.         setParent $parent;
  48.         
  49.         setUITemplate -pushTemplate DefaultTemplate;
  50.         
  51.         columnLayout -adj true mayaVerboseCol;
  52.             checkBoxGrp
  53.                 -label "Use Full Names for Attributes on Nodes"
  54.                 -ncb 1
  55.                 -width 600
  56.                 -columnWidth 1 258
  57.                 -label1 " " mayaVerboseGrp;
  58.                     
  59.         // Now set to current settings.
  60.         $currentOptions = $initialSettings;
  61.         if (size($currentOptions) > 0) {
  62.             tokenize($currentOptions, ";", $optionList);
  63.             for ($index = 0; $index < size($optionList); $index++) {
  64.                 tokenize($optionList[$index], "=", $optionBreakDown);
  65.                 if ($optionBreakDown[0] == "v") {
  66.                     if ($optionBreakDown[1] == "0") {
  67.                         checkBoxGrp -e -v1 0 mayaVerboseGrp;
  68.                     } else {
  69.                         checkBoxGrp -e -v1 1 mayaVerboseGrp;
  70.                     }
  71.                 }
  72.             }
  73.         }
  74.         setUITemplate -popTemplate;
  75.         
  76.         $result = 1;
  77.     
  78.     } else if ($action == "query") {
  79.         // Set verbose option
  80.         if (`checkBoxGrp -q -value1 mayaVerboseGrp` == 1) {
  81.             $currentOptions = $currentOptions + "v=1";
  82.         } else {
  83.             $currentOptions = $currentOptions + "v=0";
  84.         }
  85.         eval($resultCallback+" \""+$currentOptions+"\"");
  86.         $result = 1;
  87.     } else {
  88.         $bResult = 0;
  89.     }
  90.     
  91.     return $bResult;
  92. }
  93.